<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
 <%@ include file="/header.jsp" %>
<script type="text/javascript" src="${ctx}/js/backend/backend.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery-1.11.1.min_044d0927.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery.bxslider_e88acd1b.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="${ctx}/js/shade.js"></script>
</head>
<body>
<%@ include file="/searchBar.jsp" %>
<!--End Header End-->
<div class="i_bg bg_color">
  <!--Begin 用户中心 Begin -->
  <div class="m_content">
    <%@ include file="/LeftBar.jsp"%>
    <div class="m_right" id="content">
      <div class="mem_tit">分类列表</div>
      <p align="right">
        <a href="javascript:void(0);" onclick="toAddProductCategory();" class="add_b">添加分类</a>
        <br>
      </p>
      <br>
      <table border="0" class="order_tab" style="width:930px; text-align:center; margin-bottom:30px;" cellspacing="0" cellpadding="0">
        <tbody>
        <tr>
          <td width="5%">选择</td>
          <td width="20%">分类名称</td>
          <td width="25%">分类级别</td>
          <td width="25%">父级分类</td>
          <td width="25%" >操作</td>
        </tr>
        <c:forEach items="${utils.list}" var="temp">
          <tr>
            <td width="5%"><input type="radio" value="${temp.id}" name="select" onclick="toUpdateProductCategoryList(this);"/></td>
            <td>${temp.name}</td>
            <td>
            <c:choose>
               <c:when test="${temp.type==1}">一级分类</c:when>
               <c:when test="${temp.type==2}">二级分类</c:when>
               <c:when test="${temp.type==3}">三级分类</c:when>
            </c:choose>
            </td>
            <td>
            <c:if test="${empty temp.parentId}">
            	无
            </c:if>
            <c:if test="${not empty temp.parentId}">
            	${temp.parentId}
            </c:if>
            </td>
            <td><a href="javascript:void(0);" onclick="deleteProductCategory(${temp.id},${temp.type});">删除</a></td>
          </tr>
        </c:forEach>
        </tbody>
      </table>
      
      <!-- 分页条 begin-->
           <div class="pages">
           <c:if test="${utils.pagecount>=1}">
                <c:set var="url" value="${ctx}/productCategoryServlet?action=index"></c:set>
                	<a href="${url}&currpage=1" class="p_pre">首页</a>
                <c:if test="${utils.pageindex > 1}">
                	<a href="${url}&currpage=${utils.pageindex-1}" class="p_pre">上一页</a>
				</c:if>
                	
               		<c:forEach  var="temp" begin="1" end="${utils.pagecount-utils.pageindex>3?utils.pageindex+3:utils.pagecount}" step="1">
               		
		            <c:if test="${utils.pageindex==temp }">
		                <a href="${url}&currpage=${temp}" class="cur">${temp}</a>
		            </c:if>
		            <c:if test="${utils.pageindex!=temp }">
		                <a href="${url}&currpage=${temp}">${temp}</a>
		            </c:if>
		       </c:forEach>
                	
                	
                <c:if test="${utils.pageindex < utils.pagecount}">
                	<a href="${url}&currpage=${utils.pageindex+1}" class="p_pre">下一页</a>
				</c:if>
				
				
                	<a href="${url}&currpage=${utils.pagecount}" class="p_pre">尾页</a>
                	
                	</c:if>
				 <c:if test="${utils.pagecount==0}">
				        暂无记录
				    </c:if>
                </div>
		 <!-- 分页条 end-->
      <div id="addProductCategory">

      </div>
    </div>
  </div>
  <%@ include file="/footer.jsp" %>
</div>
</body>
</html>